<template>
    <div class="welcome_container">
        <el-form
            ref="formRef"
            :model="formData"
            :rules="rules"
            label-width="120px"
            :disabled="props.pageType == 'look'">
            <el-form-item label="引流员工" prop="employee_ids">
                <div class="form-staffs">
                    <div class="staffs">
                        <el-tag
                            v-for="item in creators"
                            :key="item.name"
                            class="staffs_item"
                            :closable="pageType !== 'look'"
                            :type="item.id"
                            @close="handleClose(item)">
                            {{ item.name }}
                        </el-tag>
                    </div>
                </div>
                <el-button plain class="select-staffs" @click="openDepart">选择成员</el-button>
            </el-form-item>
            <el-form-item label="欢迎语设置：">
                <!-- <el-switch v-model="formData.welcome_switch" class="ml-2" :active-value="1" :inactive-value="2" /> -->
                <el-radio v-model="formData.welcome_type" :label="1">新建欢迎语</el-radio>
                <el-radio v-model="formData.welcome_type" :label="3">已有欢迎语</el-radio>
                <div v-if="formData.welcome_type == 3">
                    <el-button plain @click="onWelcome">选择已有欢迎语</el-button>
                </div>
            </el-form-item>
            <el-form-item prop="welcome_info.welcome_text">
                <div class="content_detail">
                    <div class="content_left">
                        <div class="list_item">
                            <MaterialContent
                                ref="materialContentRef"
                                :max-num="8"
                                :input-content-tabs="inputContentTabs"
                                :show-material-tabs="showMaterialTabs"
                                :input-content-data="formData.welcome_info.welcome_text"
                                :material-content-data="materialContentData"
                                :placeholder="'请输入欢迎语'"
                                :disabled="props.pageType == 'look'"
                                :welcome-friend-id="welcomeFriendId"
                                @change="changeMaterial" />
                        </div>
                    </div>
                    <div class="content-right" :style="marginTop">
                        <div class="title">欢迎语预览</div>
                        <PhonePreview ref="phonePreviewRef" />
                    </div>
                </div>
                <!-- <el-input maxlength="2000" show-word-limit @input="onName" id="welcomeContent" v-model="formData.welcome.content" :rows="6" type="textarea" placeholder="请输入欢迎语" class="content_input" />
          <div class="text_btn">
            <div>
              <span @click="onNickName('##客户姓名## ')" style="cursor: pointer">插入客户昵称</span>
              <span style="margin: 0 6px 0 18px; color: #33302d; cursor: pointer" @click="onOpenUpload('1',true)">选择文本</span>
              <span style="cursor: pointer" @click="emojiVisible = !emojiVisible">😊</span>
              <span @click="onNickName('##员工别名## ')" style="cursor: pointer" class="alias">插入员工别名</span>
              <span @click="onNickName('##员工姓名## ')" style="cursor: pointer" class="alias">插入员工姓名</span>
            </div>
            <div>
              <span>{{ formData.welcome.content.length }}/1000</span>
            </div>
          </div>
          表情管理 -->
                <!-- <div class="emoj_box">
            <ZWEmoji v-show="emojiVisible" @choose="chooseEmoji" />
          </div> -->
                <!-- 文件信息 -->
                <!-- <el-scrollbar class="upload_list_box" max-height="230px">
            <ul class="upload_list">
              <li class="upload_item" v-for="item in fileInfo" :key="item.id">
                <img class="file_icon" :src="item.cur_icon" alt="" />
                <div class="file_name">{{ item.name }}</div>
                <img class="del_icon" @click="onRemove(item.id)" src="@/assets/image/channel/remove_icon.png" />
              </li>
            </ul>
          </el-scrollbar> -->
                <!-- 选择素材 -->
                <!-- <el-popover placement="top-start" popper-class="pop_select_box" :width="400" trigger="hover">
            <template #reference>
              <div class="text_hover"> <span style="font-size: 22px; margin-right: 5px">+</span> 添加图片/视频/音频/文件/链接/收集表/电商/公众号/小程序</div>
            </template>
            <template #default>
              <div class="upload_pop">
                <div class="item_pop" v-for="item in uploadList" :key="item.id" @click="onOpenUpload(item.id)">
                  <img class="item_pop_icon" :src="item.icon" alt="" />
                  <span class="item_pop_name">{{ item.name }}</span>
                </div>
              </div>
            </template>
          </el-popover> -->
                <!-- 欢迎语预览 -->
                <!-- <div class="prev_box">
            <div class="phone_con">
              <span class="phone-title">欢迎语预览</span>
              <el-scrollbar class="phone_List">
                <div class="bg_friend">

                  <div class="user_con" v-for="item in fileList" :key="item.id">
                    <img class="user_avator" src="/static/user.png" alt="" />
                    <div class="friend_main">
                      <div class="user_name">{{ item.user_name || '张三' }}</div> -->
                <!--欢迎语-->
                <!-- <template v-if="item.type == 0">
                        <div class="welcomeWords">{{ item.content }}</div>
                      </template> -->
                <!-- 图片 -->
                <!-- <template v-if="item.type == 1">
                        <el-image class="send_image" :src="item.absolute_url" alt="" fit="cover">
                          <template #error>
                            <el-image class="send_image" src="/static/file/pic.png" alt=""></el-image>
                          </template>
                        </el-image>
                      </template> -->
                <!-- 视频 -->
                <!-- <template v-else-if="item.type == 2">
                        <div class="video_list">
                          <el-image class="video_image" :src="item.thumbnail_url" alt="" fit="cover">
                            <template #error>
                              <el-image class="video_image" src="/static/file/mov.png" alt=""></el-image>
                            </template>
                          </el-image>
                          <el-image class="video_play" src="/static/play.png" alt="" fit="cover"></el-image>
                        </div>
                      </template> -->
                <!-- 链接 -->
                <!-- <template v-else-if="item.type == 3">
                        <div class="user_link">
                          <div class="user_link_tit">{{ item.title || item.name }}</div>
                          <div class="user_link_main m_t">
                            <div class="user_link_desc">{{ item.content  }}</div>
                            <el-image :src="item.cover_image_url" alt="" class="user_link_icon" fit="cover">
                              <template #error>
                                <el-image class="user_link_icon" src="/static/file/pic.png" alt=""></el-image>
                              </template>
                            </el-image>
                          </div>
                        </div>
                      </template> -->
                <!-- 音频 -->
                <!-- <template v-else-if="item.type == 4">
                        <div class="user_file">
                          <div class="user_file_main">
                            <div class="user_file_desc">{{ item.title || item.name }}</div>
                            <el-image :src="item.cur_icon" alt="" class="user_file_icon" fit="cover"></el-image>
                          </div>
                          <div class="user_file_size">
                            {{ item.file_size ? (item.file_size / 1024 / 1024).toFixed(2) + ' M' : '' }}
                          </div>
                        </div>
                      </template> -->
                <!-- 文件 -->
                <!-- <template v-else-if="item.type == 5">
                        <div class="user_file">
                          <div class="user_file_main">
                            <div class="user_file_desc">{{ item.title || item.name }}</div>
                            <el-image :src="getSuffixIcon(item.name)" alt="" class="user_file_icon" fit="cover"></el-image>
                          </div>
                        </div>
                      </template> -->
                <!-- 电商素材 商品素材 -->
                <!-- <template v-else-if="item.type == 7">
                        <div class="user_file">
                          <div class="user_file_main">
                            <div class="user_file_desc">{{ item.product_name }}</div>
                            <el-image :src="item.cur_icon" alt="" class="user_file_icon" fit="cover"></el-image>
                          </div>
                        </div>
                      </template> -->
                <!-- 电商素材 页面素材 -->
                <!-- <template v-else-if="item.type == 8">
                        <div class="user_file">
                          <div class="user_file_main">
                            <div class="user_file_desc">{{ item.page_name }}</div>
                            <el-image :src="item.cur_icon" alt="" class="user_file_icon" fit="cover"></el-image>
                          </div>
                        </div>
                      </template> -->

                <!-- 收集表 -->
                <!-- <template v-else-if="item.type == 9">
                        <div class="user_file">
                          <div class="user_file_main">
                            <div class="user_file_desc">{{ item.title }}</div>
                            <el-image :src="item.cur_icon" alt="" class="user_file_icon" fit="cover"></el-image>
                          </div>
                        </div>
                      </template> -->
                <!-- 公众号图文 -->
                <!-- <template v-else-if="item.type == 10">
                        <div class="user_file">
                          <div class="user_file_main">
                            <div class="user_file_desc">{{ item.title ||item.name }}</div>
                            <el-image :src="item.cur_icon" alt="" class="user_file_icon" fit="cover"></el-image>
                          </div>
                        </div>
                      </template> -->
                <!-- 小程序素材 -->

                <!-- <template v-else-if="item.type == 11">
                        <div class="miniApp">
                          <div class="mini_box">
                            <img class="mini_icon" src="@/assets/chatDetails/Appletbg.png" alt="" />
                            <div class="miniName">{{ item.title }}</div>
                          </div>
                          <div class="mini_bg">
                            <el-image :src="item?.image_url" alt="" class="miniImg" fit="contain">
                              <template #error>
                                <div class="image-slot">
                                  <img :src="item.cur_icon" alt="" />
                                </div>
                              </template>
                            </el-image>
                          </div>
                          <div class="mini_bot">
                            <img src="@/assets/chatDetails/Applet.png" alt="" />
                            <span>小程序</span>
                          </div>
                        </div>
                      </template>
                    </div>
                  </div>
                </div>
              </el-scrollbar>
            </div>
          </div> -->
            </el-form-item>
            <div style="text-align: center; border-top: 1px solid #d9d9d9; margin-bottom: 16px"></div>
            <el-form-item label="活动图文" prop="activity_image">
                <div class="img_box">
                    <div>图文封面</div>
                    <UploadImg
                        :rule="{
                            type: 'jpg|JPG|jpeg|JPEG|png|PNG',
                            unit: 'MB',
                            size: 2
                        }"
                        :url="formData.activity_image"
                        @submit="v => (formData.activity_image = v)" />
                    <div class="text">图片支持JPG、PNG、JPEG格式，大小2M以内，建议宽高比为1：1，尺寸200px*200px。</div>
                </div>
            </el-form-item>
            <div style="width: 780px">
                <el-form-item label="活动标题" label-width="190px" prop="title">
                    <el-input v-model="formData.title" placeholder="呼朋唤友, 免费拿奖品" />
                </el-form-item>
                <el-form-item label="填写描述" label-width="190px" prop="desc">
                    <el-input
                        v-model="formData.desc"
                        maxlength="150"
                        show-word-limit
                        :rows="4"
                        type="textarea"
                        placeholder="好友，你可以给我打个call吗？"
                        class="content_input" />
                </el-form-item>
            </div>
            <el-form-item label="完成客户打标" label-width="130px">
                <div>
                    <el-tag
                        v-for="tag in AllTags"
                        :key="tag"
                        class="mx-1"
                        size="small"
                        style="margin-right: 5px"
                        :closable="props.pageType !== 'look'"
                        @close="onClose1(tag)">
                        {{ tag.name }}
                    </el-tag>
                </div>
                <el-button plain @click="selecTag">选择标签</el-button>
            </el-form-item>
        </el-form>
    </div>
    <!-- 素材弹框 -->
    <ZWMatericalLib ref="ZWMatericalLibRef" @submit="getFiles" />

    <!-- 已有欢迎语弹框 -->
    <Dialog :app-dialog="appDialog">
        <ZwTable
            ref="tableRef"
            class="table-box"
            :option="tableOption"
            :row-key="getRowKey"
            :fetch-params="state.searchParams"
            :fetch-api="fetchApi()"
            @radioChange="handleCurrentChange"></ZwTable>

        <!-- <ZWPagination ref="PaginationRef" @submit="getChannelFriendList" /> -->
    </Dialog>
    <!-- 选择部门员工弹框 -->
    <ZWDepart ref="DepartRef" :type="1" @submit="getDepart" />
    <!-- 客户标签 -->
    <BatchLabel ref="BatchLabelRef" @save="getTags" />
    <!--选择已有欢迎语-->
    <SelectAlreadyMaterial
        ref="selectAlreadyMaterialRef"
        v-model="selectAlreadyMaterialShow"
        @select="selectAlreadyMaterialFn" />
</template>

<script setup lang="tsx">
import MaterialContent from '@/components/zw/materialContent/index.vue';
import PhonePreview from '@/components/zw/phonePreview/welcomePhonePreview/materialPreview/index.vue';
import UploadImg from '@/view/smartMarketing/components/UploadImg.vue';
import { ref, reactive, onMounted, nextTick, watch, computed } from 'vue';
import type { FormInstance, UploadProps, UploadUserFile } from 'element-plus';
import ZWDepart from '@/components/ZWDepart.vue';
import ChooseWelcome from '@/components/welcome/ChooseWelcome.vue';
import BatchLabel from '@/components/BatchLabel.vue';
import { useRouter } from 'vue-router';
import { useStore } from '@/store';
import {
    DFormat,
    getSetionId,
    IsNotEmpty,
    getSuffixIcon,
    useInsertWelcomeContent,
    initMaterialData,
    initAlreadyMaterialData
} from '@/utils/utils';
import SelectAlreadyMaterial from '@/components/zw/selectAlreadyMaterial/index.vue';
import { ElMessage, ElImage, ElIcon, ElButton, ElBadge, ElTooltip } from 'element-plus';
// import ZWMatericalLib from '@/components/channel/ZWMatericalLib.vue'
// import ZWMatericalLib from '@/components/channelNew/ZWMatericalLibNew.vue'
import ZWMatericalLib from '@/components/channelNew/ZWMatericalLib.vue';
import ZwTable from '@/components/zw/table/Table';
import ZWEmoji from '@/components/ZWEmoji.vue';
import Dialog from '@/components/Dialog.vue';
import { deepCopy } from '@/utils/helper';
import { channelFriendList } from '@/api/channel/qwbase';
import { uploadFile2 } from '@/api/common';
// import WelcomeTime from './WelcomeTime.vue'
const materialContentRef = ref<HTMLElement | null>();
const phonePreviewRef = ref<HTMLElement | null>();
const inputContentTabs = ref<Array<number>>([1, 2, 3, 4, 5]); // 配置欢迎语输入框选项
const showMaterialTabs = ref<Array<string>>(['1', '2', '3', '4', '5', '7', '9', '11', '10']); // 配置选择素材组件类型
const materialContentData = ref<Array<any>>([]);
const props = defineProps<{
    pageType: {
        type: string;
    };
}>();

const selectAlreadyMaterialRef = ref<HTMLElement | null>();
const selectAlreadyMaterialShow = ref<boolean>(false);
const welcomeFriendId = ref<any>('');

const router = useRouter();
const store = useStore();
const uploadList = reactive([
    { id: '2', icon: '/static/file/pic.png', name: '图片' },
    { id: '3', icon: '/static/file/mp3.png', name: '音频' },
    { id: '4', icon: '/static/file/mov.png', name: '视频' },
    { id: '5', icon: '/static/file/ysb.png', name: '文件' },
    { id: '6', icon: '/static/file/link.png', name: '链接' },
    { id: '27', icon: '/static/file/form.png', name: '收集表' },
    { id: '99', icon: '/static/file/shop.png', name: '电商' },
    { id: '15', icon: '/static/file/official.png', name: '公众号' },
    { id: '11', icon: '/static/file/miniApp.png', name: '小程序' }
]);
const onURL = (data: any) => {
    const fileTYpe = {
        '.pdf': '/static/file/pdf.png',
        '.doc': '/static/file/doc.png',
        '.docx': '/static/file/doc.png',
        '.xls': '/static/file/xls.png',
        '.xlsx': '/static/file/xls.png',
        '.ppt': '/static/file/ppt.png',
        '.pptx': '/static/file/ppt.png'
    };
    if (data) {
        const last = data.substring(data.lastIndexOf('.'));
        return fileTYpe[last] || '/static/file/file.png';
    }
};
const changeMaterial = (val: any) => {
    formData.value.welcome_info = val.welcome_info;
};
const selectAlreadyMaterialFn = (data: any) => {
    const { content, welcome_friend_attachment, id } = data;
    welcomeFriendId.value = id;
    formData.value.welcome_info.welcome_text = content;
    materialContentData.value = initAlreadyMaterialData(welcome_friend_attachment);
};
const formRef = ref<FormInstance>();
const DepartRef: any = ref<null | HTMLElement>(null); // 部门弹框类型
const ZWMatericalLibRef: any = ref(null);
const BatchLabelRef: any = ref<null | HTMLElement>(null); // 选择标签弹框
const emojiVisible = ref(false);
const fileList = ref([]);
const fileInfo = ref([]);
const creators = ref([]); // 创建人options
const AllTags = ref([]); // 选择标签options
const ChooseWelcomeRef: any = ref(null);
const formData = ref({
    title: '', //标题
    desc: '', //描述
    employee_ids: [],
    winning_value: [], //完成客户打标
    welcome_switch: 1, // 欢迎语开关
    activity_image: '', //活动图片
    tag_list: [],
    welcome_info: {},
    welcome_type: 1,
    welcome: {
        type: 1, // 1 已有 3是新建
        content: '', //欢迎语内容
        attachment: [
            {
                // media_content_id: 9, //素材库ID
                // type: 1 //1 开启 2 关闭
            }
        ],
        local_link: [
            // {
            //   link_title: '', //链接标题
            //   link_url: '', //链接地址
            //   link_desc: '',
            //   link_share_image: '' //链接图片
            // }
        ], //本地链接
        local_content: [
            // {
            //   code: '', //附件码
            //   type: 1 // 1-图片 2-视频 3-链接 4-音频 5-文件
            // }
        ] //本地附件
    }
});
const marginTop = computed(() => {
    const height = 104;
    const height2 = formData.value.welcome_type === 3 ? 33 : 0;
    const height3 = creators.value.length ? 32 : 0;
    return `margin-top: -${height + height2 + height3}px`;
});
const onInsertText = useInsertWelcomeContent('welcomeContent', formData.value, 'welcome.content');
const rules = reactive({
    employee_ids: [{ required: true, message: '请选择引流员工', trigger: 'change' }],
    activity_image: [{ required: true, message: '请选择图文封面', trigger: 'change' }],
    title: [{ required: true, message: '请输入活动标题', trigger: 'blur' }],
    desc: [{ required: true, message: '请输入活动描述', trigger: 'blur' }],
    winning_value: [{ required: true, message: '请选择客户标签', trigger: 'change' }],
    'welcome_info.welcome_text': [{ required: true, message: '请输入欢迎语内容', trigger: 'blur' }]
});
const tableOption = [
    {
        width: 55,
        fixed: 'left',
        isRadio: true
    },
    {
        prop: 'content',
        label: '欢迎语',
        width: 220,
        showOverflowTooltip: true
    },
    {
        prop: 'welcome_friend_attachment',
        label: '素材',
        width: 300,
        render({ row }) {
            return (
                <>
                    <div class="contentBox" vShow={row.welcome_friend_attachment.length}>
                        {row.welcome_friend_attachment.map((v: any) => {
                            return (
                                <div>
                                    <ElTooltip
                                        vShow={v.type == 1}
                                        content={
                                            v.media_file?.name +
                                            ' ' +
                                            (v.media_file?.size / 1024 / 1024).toFixed(2) +
                                            'M'
                                        }
                                        placement="top"
                                        effect="light">
                                        <ElImage
                                            vShow={v.type == 1}
                                            class="wel_content_file_item"
                                            src={v.media_file?.absolute_url || '/static/file/pic.png'}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 2}
                                        content={v.media_file?.name}
                                        placement="top"
                                        effect="light">
                                        <div class="pay-item">
                                            <div class="play"></div>
                                            <ElImage
                                                vShow={v.type == 2 && v.media_file?.absolute_url}
                                                class="wel_content_file_item"
                                                src={
                                                    `${v.media_file?.absolute_url}?x-oss-process=video/snapshot,t_0,f_jpg,w_320,h_240,m_fast` ||
                                                    '/static/file/mov.png'
                                                }
                                                initial-index={1}
                                                style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                            <ElImage
                                                vShow={v.type == 2 && !v.media_file?.absolute_url}
                                                class="wel_content_file_item"
                                                src={'/static/file/mov.png'}
                                                style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                        </div>
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 3}
                                        content={v.link_title}
                                        placement="top"
                                        effect="light">
                                        <img
                                            vShow={v.type == 3}
                                            class="wel_content_file_item"
                                            src="/static/file/link.png"
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"
                                        />
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 4}
                                        content={v.media_file?.name}
                                        placement="top"
                                        effect="light">
                                        <img
                                            vShow={v.type == 4}
                                            class="wel_content_file_item"
                                            src="/static/file/mp3.png"
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"
                                        />
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 5}
                                        content={v.media_file?.name}
                                        placement="top"
                                        effect="light">
                                        <img
                                            vShow={v.type == 5}
                                            class="wel_content_file_item"
                                            src={getSuffixIcon(v.media_file?.name)}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"
                                        />
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 8}
                                        content={v.link_title}
                                        placement="top"
                                        effect="light">
                                        <ElImage
                                            vShow={v.type == 8 && v.link_share_image}
                                            class="wel_content_file_item"
                                            src={v.link_share_image}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                        <ElImage
                                            vShow={v.type == 8 && !v.link_share_image}
                                            class="wel_content_file_item"
                                            src={'/static/file/wbgg.png'}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 9}
                                        content={v.collect_form?.title}
                                        placement="top"
                                        effect="light">
                                        <ElImage
                                            vShow={v.type == 9 && v.collect_form?.cover_image}
                                            class="wel_content_file_item"
                                            src={v.collect_form?.cover_image}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                        <ElImage
                                            vShow={v.type == 9 && !v.collect_form?.cover_image}
                                            class="wel_content_file_item"
                                            src={'/static/file/wbgg.png'}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 7}
                                        content={v.retail_product?.product_name}
                                        placement="top"
                                        effect="light">
                                        <img
                                            vShow={v.type == 7}
                                            class="wel_content_file_item"
                                            src={v.retail_product?.cover || '/static/file/mp3.png'}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"
                                        />
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 10}
                                        content={v.official_article?.content}
                                        placement="top"
                                        effect="light">
                                        <ElImage
                                            vShow={v.type == 10 && v.official_article?.cover}
                                            class="wel_content_file_item"
                                            src={v.official_article?.cover}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                        <ElImage
                                            vShow={v.type == 10 && !v.official_article?.cover}
                                            class="wel_content_file_item"
                                            src={'/static/file/wbgg.png'}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"></ElImage>
                                    </ElTooltip>
                                    <ElTooltip
                                        vShow={v.type == 11}
                                        content={v.miniprogram?.title}
                                        placement="top"
                                        effect="light">
                                        <img
                                            vShow={v.type == 11}
                                            class="wel_content_file_item"
                                            src={v.miniprogram?.image_url}
                                            style="width: 40px; height: 40px; margin-right: 5px; margin-bottom: 5px"
                                        />
                                    </ElTooltip>
                                </div>
                            );
                        })}
                    </div>
                    <p vShow={row.welcome_friend_attachment.length == 0}>--</p>
                </>
            );
        }
    },
    {
        prop: 'send_times',
        label: '消息数量',
        width: 120
    },
    {
        prop: 'depart',
        label: '生效部门、员工',
        width: 150,
        render({ row }) {
            return (
                <div class="depart_main">
                    {row.department > 0 ? getSetionId('name', row.department).join('、') : ' '}
                    {row.work_user.length > 0 ? getSetionId('name', row.work_user).join('、') : ''}
                </div>
            );
        }
    },
    {
        prop: 'user_name',
        label: '创建人',
        width: 120
    },
    {
        prop: 'user_local_department',
        label: '所在部门',
        width: 150,
        render({ row }) {
            return (
                <span>
                    {row.user_local_department && row.user_local_department.length > 0
                        ? getSetionId('name', row.user_local_department).join('、')
                        : '--'}
                </span>
            );
        }
    },
    {
        prop: 'created_at',
        label: '创建时间',
        width: 180
    },
    {
        prop: 'updated_at',
        label: '修改时间',
        width: 180
    }
];
const defaultParams = reactive({
    page: 1,
    limit: 15
});
const state = reactive({
    searchParams: deepCopy(defaultParams)
});
const getRowKey = (row: any) => {
    return row.id;
};
const fetchApi = () => {
    // 获取文件列表
    // getTableH()
    return channelFriendList;
};
const handleCurrentChange = (selection: any) => {
    seleItem.value = selection;
};
//更改欢迎语
const onName = () => {
    fileList.value[0] = {
        type: 0,
        content: formData.value.welcome.content
    };
};
//打开新建选择人
const openDepart = () => {
    DepartRef.value.isQRAuth = true;
    DepartRef.value.departVisble = true;
    DepartRef.value.selectedMember = creators.value;
};
// 获取部门成员
const getDepart = (res: any) => {
    creators.value = res;
    formData.value.employee_ids = getSetionId('id', creators.value);
};
// 员工数据
const tags = reactive([]);
// 员工移除
const handleClose = (tag: any) => {
    creators.value = creators.value.filter((item: any) => item.id !== tag.id);
    formData.value.employee_ids = getSetionId('id', creators.value);
    DepartRef.value.removeItem(tag);
};
// 打开选择标签
const selecTag = () => {
    BatchLabelRef.value.hasConditiion = false;
    BatchLabelRef.value.dialogData.labelChooseType = 2;
    BatchLabelRef.value.chooseDataArr = [...AllTags.value];
    BatchLabelRef.value.dialogVisible = true;
};
// 获取标签
const getTags = (data: any) => {
    AllTags.value = [...data.data];
    formData.value.winning_value = getSetionId('id', data.data);
};
// 移除标签
const onClose1 = (tag: any) => {
    AllTags.value = AllTags.value.filter(item => item.id != tag.id);
    formData.value.winning_value = getSetionId('id', AllTags.value);
};
// 插入名字
const onNickName = (text: string) => {
    if (props.pageType == 'look') return;
    onInsertText(text);
    fileList.value[0] = {
        type: 0,
        content: formData.value.welcome.content
    };
};
//表情包管理
const chooseEmoji = (emoji: any) => {
    //事件。数据包含文本区域的值
    if (props.pageType == 'look') return;
    onInsertText(emoji);
    fileList.value[0] = {
        type: 0,
        content: formData.value.welcome.content
    };
    emojiVisible.value = false;
};
//打开素材上传框
const onOpenMaterial = (num: string) => {
    if (props.pageType == 'look') return;
    const showTabs = ['1'];
    ZWMatericalLibRef.value.showTabs = showTabs;
    ZWMatericalLibRef.value.multiple = true;
    ZWMatericalLibRef.value.baseId = num; //打开对应的基础素材
    ZWMatericalLibRef.value.existFile = Number(9 - fileList.value.length); //打开对应的基础素材
    ZWMatericalLibRef.value.materVisible = true;
};

// 打开素材上传框
const onOpenUpload = (num: string, flag = false) => {
    if (props.pageType == 'look') return;

    if (flag) {
        const showTabs = ['1'];
        ZWMatericalLibRef.value.showTabs = showTabs;
        ZWMatericalLibRef.value.baseId = num;
        ZWMatericalLibRef.value.materVisible = true;
    } else {
        const showTabs = uploadList.map(item => item.id);
        ZWMatericalLibRef.value.showTabs = showTabs;
        ZWMatericalLibRef.value.localUploadisShow = ['2', '3', '4', '5', '6'];
        ZWMatericalLibRef.value.baseId = num; //打开对应的基础素材
        if (num == '15') {
            ZWMatericalLibRef.value.multiple = false;
        }
        ZWMatericalLibRef.value.existFile = Number(9 - fileList.value.length); //打开对应的基础素材
        ZWMatericalLibRef.value.materVisible = true;
    }
};

//获取素材
const getFiles = (res: any, local = false) => {
    if (res.length + formData.value.welcome.attachment.length > 8) {
        ElMessage.error('最多只能上传8个素材,请删除后再上传');
        return;
    }

    if (local) {
        if (res.data.length > 0) {
            res.data.forEach((item: any) => {
                item.type = res.type;
                item.user_name = '张三';
                onLocalType(item, local);
            });
        }
    } else if (res instanceof Array) {
        if (res[0].type == 0) {
            onLocalType(res[0], local);
        } else {
            if (res.length > 0) {
                res.forEach(ite => {
                    onLocalType(ite, local);
                });
            }
        }
    }
};

const onLocalType = (res: any, local = false) => {
    //
    if (local) {
        // 链接
        if (res.type == 6) {
            const { code, content, cover_image_url, link_desc, link_url, title } = res.data[0];
            formData.value.welcome.local_link.push({
                link_title: title,
                link_url: link_url,
                link_desc: link_desc,
                link_share_image: cover_image_url
            });
            // formData.value.local_content.push({ code: code, type: 3 })
            fileList.value.push({ id: code, ...res.data[0], type: 3 });
            fileInfo.value.push({ id: code, cur_icon: '/static/file/link.png', name: res.data[0].title });
        } else {
            const { code, name, url } = res.data[0];
            if (res.type == 2) {
                fileList.value.push({ id: code, absolute_url: url, type: 1 });
                formData.value.welcome.local_content.push({ code: code, type: 1 });
                fileInfo.value.push({ id: code, cur_icon: '/static/file/pic.png', name: name });
            }
            if (res.type == 3) {
                fileList.value.push({ id: code, absolute_url: url, type: 4 });
                formData.value.welcome.local_content.push({ code: code, type: 4 });
                fileInfo.value.push({ id: code, cur_icon: '/static/file/mp3.png', name: name });
            }
            if (res.type == 4) {
                fileList.value.push({
                    id: code,
                    absolute_url: url,
                    type: 2,
                    thumbnail_url: `${url}?x-oss-process=video/snapshot,t_0,f_jpg,w_320,h_240,m_fast`
                });
                formData.value.welcome.local_content.push({ code: code, type: 2 });
                fileInfo.value.push({ id: code, cur_icon: '/static/file/mov.png', name: name });
            }
            if (res.type == 5) {
                fileInfo.value.push({ id: code, cur_icon: onURL(url), name: name });
                fileList.value.push({ id: code, absolute_url: url, type: 5, ...res.data[0] });
                formData.value.welcome.local_content.push({ code: code, type: 5 });
            }
            // 收集表
            if (res.type == 9) {
                fileList.value.push({ id: code, absolute_url: url, type: 9 });
                formData.value.welcome.local_content.push({ code: code, type: 9 });
                fileInfo.value.push({ id: code, cur_icon: '/static/file/form.png', name: name });
            }

            // 商品素材
            if (res.type == 7) {
                fileList.value.push({ id: code, absolute_url: url, type: 7 });
                formData.value.welcome.local_content.push({ code: code, type: 7 });
                fileInfo.value.push({ id: code, cur_icon: '/static/file/shop.png', name: name });
            }

            // 页面素材
            if (res.type == 12) {
                fileList.value.push({ id: code, absolute_url: url, type: 8 });
                formData.value.welcome.local_content.push({ code: code, type: 8 });
                fileInfo.value.push({ id: code, cur_icon: '/static/file/shop.png', name: name });
            }
        }
    } else {
        // 文本
        if (res.type == 0) {
            const arr = [...new Set(res.data)];
            arr.forEach((item: any) => {
                onInsertText(item.content);
                fileList.value[0] = {
                    type: 0,
                    content: formData.value.welcome.content
                };
            });
        }
        // 图片
        if (res.type == 1) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 1,
                    media_content_id: item.id
                });
                fileList.value.push({ ...item, ...{ type: 1 } });
                fileInfo.value.push({ id: item.id, cur_icon: '/static/file/pic.png', name: item.file_name });
            });
        }
        // 视频
        if (res.type == 2) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 2,
                    media_content_id: item.id
                });
                fileList.value.push({ ...item, ...{ type: 2 } });
                fileInfo.value.push({ id: item.id, cur_icon: '/static/file/mov.png', name: item.file_name });
            });
        }
        // 链接
        if (res.type == 3) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 3,
                    media_content_id: item.id
                });
                fileList.value.push({ ...item, ...{ type: 3 } });
                fileInfo.value.push({ id: item.id, cur_icon: '/static/file/link.png', name: item.title });
            });
        }
        // 音频
        if (res.type == 4) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 4,
                    media_content_id: item.id
                });

                item.cur_icon = '/static/file/mp3.png';
                fileList.value.push({ ...item, ...{ type: 4 } });
                fileInfo.value.push({ id: item.id, cur_icon: '/static/file/mp3.png', name: item.file_name });
            });
        }

        // 文件
        if (res.type == 5) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 5,
                    media_content_id: item.id
                });
                item.name = item.mediaFileInfo.name;
                fileList.value.push({ ...item });
                fileInfo.value.push({ id: item.id, cur_icon: onURL(item.mediaFileInfo.url), name: item.name });
            });
        }
        // 商品素材
        if (res.type == 7) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 7,
                    media_content_id: item.id
                });
                item.cur_icon = '/static/file/shop.png';
                fileList.value.push({ ...item, ...{ type: 7 } });
                fileInfo.value.push({ id: item.id, cur_icon: '/static/file/shop.png', name: item.product_name });
            });
        }
        // 页面素材
        if (res.type == 8) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 8,
                    media_content_id: item.id
                });
                item.cur_icon = '/static/file/shop.png';
                fileList.value.push({ ...item, ...{ type: 8 } });
                fileInfo.value.push({ id: item.id, cur_icon: '/static/file/shop.png', name: item.page_name });
            });
        }
        // 收集表
        if (res.type == 9) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 9,
                    media_content_id: item.id
                });
                item.cur_icon = '/static/file/form.png';
                fileList.value.push({ ...item, ...{ type: 9 } });
                fileInfo.value.push({ id: item.id, cur_icon: '/static/file/form.png', name: item.title });
            });
        }
        // 公众号图文
        if (res.type == 10) {
            res.data[0].article_detail.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 10,
                    media_content_id: item.id
                });
                switch (item.type) {
                    case 1:
                        item.cur_icon = item.cover || '/static/file/official.png';
                        item.name = item.title;
                        break;
                    case 2:
                        item.cur_icon = '/static/file/text.png';
                        item.name = item.title;
                        break;
                    case 3:
                        item.cur_icon = '/static/file/mov.png';
                        item.name = '视频';
                        break;
                    case 4:
                        item.cur_icon = '/static/file/mp3.png';
                        item.name = '音频';
                        break;
                    case 5:
                        item.cur_icon = '/static/file/pic.png';
                        item.name = '图片';
                        break;
                }
                fileList.value.push({ ...item, ...{ type: 10 } });
                fileInfo.value.push({ ...item });
            });
        }
        // 小程序
        if (res.type == 11) {
            res.data.forEach((item: any) => {
                formData.value.welcome.attachment.push({
                    type: 11,
                    media_content_id: item.id
                });
                item.cur_icon = '/static/file/miniApp.png';
                fileList.value.push({ ...item, ...{ type: 11 } });
                fileInfo.value.push({ id: item.id, cur_icon: '/static/file/miniApp.png', name: item.title });
            });
        }
    }
};
// 删除上传的文件
const onRemove = (id: any) => {
    if (props.pageType == 'look') return;

    fileList.value = fileList.value.filter((item: any) => item.id != id);
    fileInfo.value = fileInfo.value.filter((item: any) => item.id != id);
    formData.value.welcome.attachment = formData.value.welcome.attachment.filter(
        (item: any) => item.media_content_id != id
    );
    formData.value.welcome.attachment = formData.value.welcome.attachment.filter(
        (item: any) => item.media_file_id != id
    );
    formData.value.welcome.local_link = formData.value.welcome.local_link.filter((item: any) => item.link_title != id);
    formData.value.welcome.local_content = formData.value.welcome.local_content.filter((item: any) => item.id != id);
};
// 已有欢迎语
// 弹框配置项
const tableData = ref([]); //已有欢迎语数据
const seleItem = ref(); // 选中的欢迎语数据
const multipleTable = ref();
// 选择已有素材取消
const cancelHandel = () => {
    appDialog.visible = false;
};
const onWelcome = (data?: any) => {
    selectAlreadyMaterialShow.value = true;
};
// 选择已有素材确认
const submitHandel = () => {
    const { content, welcome_friend_attachment } = seleItem.value;
    if (welcome_friend_attachment.length > 8) {
        ElMessage.error('最多只能上传8个素材,请删除后再上传');
        return;
    }
    formData.value.welcome.content = content;

    formData.value.welcome.attachment.splice(0, formData.value.welcome.attachment.length);
    formData.value.welcome.local_content.splice(0, formData.value.welcome.local_content.length);
    fileList.value.splice(0, fileList.value.length);
    fileInfo.value.splice(0, fileInfo.value.length);

    welcome_friend_attachment.forEach((item: any) => {
        if (item.type != 3) {
            formData.value.welcome.attachment.push({ type: item.type, media_content_id: item.content_id });
            fileList.value.push({ ...item.media_file, type: item.type });
            // 图片
            if (item.type == 1) {
                fileInfo.value.push({
                    id: item.content_id,
                    cur_icon: '/static/file/pic.png',
                    name: item.media_file.name
                });
            }
            // 视频
            if (item.type == 2) {
                fileInfo.value.push({
                    id: item.content_id,
                    cur_icon: '/static/file/mov.png',
                    name: item.media_file.name
                });
            }
            // 音频
            if (item.type == 4) {
                fileInfo.value.push({
                    id: item.content_id,
                    cur_icon: '/static/file/mp3.png',
                    name: item.media_file.name
                });
            }
            // 文件
            if (item.type == 5) {
                fileInfo.value.push({
                    id: item.content_id,
                    cur_icon: onURL(item.media_file.url),
                    name: item.media_file.name
                });
            }
        } else {
            formData.value.welcome.local_link.push({ type: 3, media_content_id: item.content_id });
            fileList.value.push({ ...item.media_content_link, id: item.content_id });
            fileInfo.value.push({ id: item.content_id, cur_icon: '/static/file/link.png', name: item.link_title });
        }
    });
    cancelHandel();
};

// 单选欢迎语
const handleSelectionChange = (selection: any) => {
    if (selection.length > 1) {
        multipleTable.value.clearSelection();
        multipleTable.value.toggleRowSelection(selection.pop());
    } else {
        seleItem.value = selection;
    }
    seleItem.value = selection[0];
};
const appDialog = reactive({
    visible: false,
    title: '选择已有欢迎语',
    width: '1200px',
    cancel: cancelHandel,
    submit: submitHandel,
    cancelText: '取消',
    submitText: '保存',
    isInit: false, //是否重置
    isChooseDisabled: false, //重新打开传递进来的数据是否重置
    chooseArr: [] // 传递进来选中的数据
});
// 获取已有素材文件列表
const getChannelFriendList = (data?: any) => {
    channelFriendList({
        page: 1,
        page_size: data?.page_size || 15,
        ...data
    }).then((res: any) => {
        tableData.value = res.data;
        store.dispatch('pageTotal', res.total);
    });
};
// 分时段欢迎语
const addTime = () => {
    formData.value.time_welcome.push({});
};
// 删除
const handleDel = (index: number) => {
    formData.value.time_welcome.splice(index, 1);
    ElMessage.success('删除成功');
};
const dialogImageUrl = ref('');
const dialogVisible = ref(false);
const picIndex = ref(0);
// 删除图片
const handleRemove: UploadProps['onRemove'] = () => {
    formData.value.activity_image = '';
};
// 图片预览
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile: any) => {
    dialogImageUrl.value = uploadFile.url!;
    dialogVisible.value = true;
};
// 上传图片
const handleChange: UploadProps['onChange'] = async (file: any) => {
    if (file.size / 1024 / 1024 > 10) {
        ElMessage.error('上传图片大小不能超过10M');
        return false;
    }
    const res = await uploadFile2({
        file: file.raw,
        fileName: file.name
    });
    formData.value.activity_image = res.url;
};
const onLookData = (val: any) => {
    formData.value.welcome_info.welcome_text = val.welcome_info.welcome_text;
    materialContentData.value = initMaterialData(val.welcome_info.welcome_material);
    welcomeFriendId.value = val.welcome_info.welcome_friend_id;
    // onName()
    // val?.forEach((item: any) => {
    //   // 图片

    //   if (item.type != 3) {
    //     if (item.content_id != 0) {
    //       formData.value.welcome.attachment.push({ type: item.type, media_content_id: item.content_id, media_file_id: 0 })
    //     } else {
    //       formData.value.welcome.attachment.push({ type: item.type, media_content_id: 0, media_file_id: item.file_id })
    //     }
    //     // 图片
    //     if (item.type == 1) {
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/pic.png', name: item.media_file.name })
    //       fileList.value.push({ ...item.media_file, type: item.type, id: item.content_id ? item.content_id : item.file_id })
    //     }
    //     // 视频
    //     if (item.type == 2) {
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/mov.png', name: item.media_file.name })
    //       fileList.value.push({ ...item.media_file, type: item.type, id: item.content_id ? item.content_id : item.file_id, thumbnail_url: `${item.media_file.absolute_url}?x-oss-process=video/snapshot,t_0,f_jpg,w_320,h_240,m_fast` })
    //     }

    //     // 音频
    //     if (item.type == 4) {
    //       fileList.value.push({ ...item.media_file, type: item.type, id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/mp3.png' })
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/mp3.png', name: item.media_file.name })
    //     }
    //     // 文件
    //     if (item.type == 5) {
    //       fileList.value.push({ ...item.media_file, type: item.type, id: item.content_id ? item.content_id : item.file_id })
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: onURL(item.media_file.url), name: item.media_file.name })
    //     }
    //     // 商品素材
    //     if (item.type == 7) {
    //       fileList.value.push({ ...item.retail_material_product, type: item.type, id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/form.png' })
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/shop.png', name: item?.retail_material_product.product_name })
    //     }
    //     // 页面素材
    //     if (item.type == 8) {
    //       fileList.value.push({ ...item.retail_material_page, type: item.type, id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/form.png' })
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/shop.png', name: item.retail_material_page.page_name })
    //     }
    //     // 收集表
    //     if (item.type == 9) {
    //       fileList.value.push({ ...item.collect_form, type: item.type, id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/form.png' })
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/form.png', name: item.collect_form.title })
    //     }
    //     // 图文公众号
    //     if (item.type == 10) {

    //       switch(item.article_type){
    //         case 1:
    //           item.cur_icon = item.link_share_image || '/static/file/official.png'
    //           item.name = item.official_article.title
    //         break;
    //         case 2:
    //           item.cur_icon = '/static/file/text.png'
    //           item.name = item.official_article.content.substring(0, 15)
    //         break;
    //         case 3:
    //           item.cur_icon = '/static/file/mov.png'
    //           item.name = '视频'
    //         break;
    //         case 4:
    //           item.cur_icon = '/static/file/mp3.png'
    //           item.name = '音频'
    //         break;
    //         case 5:
    //           item.cur_icon = '/static/file/pic.png'
    //           item.name = '图片'
    //         break;
    //       }
    //       fileList.value.push({ ...item.collect_form, name: item.name, type: item.type, id: item.content_id ? item.content_id : item.file_id, cur_icon: item.cur_icon })
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: item.cur_icon, name: item.name })
    //     }
    //     // 收集表
    //     if (item.type == 11) {
    //       fileList.value.push({ ...item.miniprogram, type: item.type, id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/form.png' })
    //       fileInfo.value.push({ id: item.content_id ? item.content_id : item.file_id, cur_icon: '/static/file/miniApp.png', name: item.miniprogram.title })
    //     }
    //   } else {
    //     // 链接
    //     if (item.content_id) {
    //       formData.value.welcome.attachment.push({ type: 3, media_content_id: item.content_id, media_file_id: 0 })
    //       fileInfo.value.push({ id: item.content_id, cur_icon: '/static/file/link.png', name: item.link_title })
    //       fileList.value.push({ ...item.media_content_link, type: item.type, id: item.content_id,name: item.link_title })
    //     } else {
    //       formData.value.welcome.local_link.push({ link_title: item.link_title, link_url: item.link_url, link_desc: item.link_desc, link_share_image: item.link_share_image })
    //       fileInfo.value.push({ id: item.link_title, cur_icon: '/static/file/link.png', name: item.link_title })
    //       fileList.value.push({ cover_image_url: item.link_share_image, type: item.type, id: item.link_title, name:item.link_title })
    //     }
    //   }
    // })
};
watch(
    () => formData.value.welcome.content,
    (newV: any, oldV: any) => {
        if (formData.value.welcome.content.length <= 1000) {
            onName();
        } else {
            formData.value.welcome.content = oldV;
        }
    },
    { immediate: true }
);
const getWelcomeContainerHeight = () => {
    const container = document.querySelector('.welcome_container');
    const h = container?.clientHeight;
    container.style.setProperty('--welcome-height', `${h}px`);
};
onMounted(() => {
    getWelcomeContainerHeight();
});
defineExpose({
    formRef,
    formData,
    creators,
    AllTags,
    onLookData
});
</script>

<style lang="scss" scoped>
.content_detail {
    box-sizing: border-box;
    display: flex;

    .content_left {
        flex: 1;
        padding-right: 48px;

        .mt20 {
            margin-top: 1.25rem;
        }
    }

    .content-right {
        padding: 0 24px 24px 48px;
        border-left: 1px solid #eaeaea;

        .title {
            margin-bottom: 8px;
            text-align: center;
            font-size: 14px;
        }
    }
}

.img_box {
    display: grid;
    grid-template-columns: 64px 110px 1fr;
    grid-gap: 20px;

    .text {
        padding-top: 80px;
        font-size: 12px;
        color: #999;
    }
}

$num: 2;

@mixin ellips($num) {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: $num;
    line-clamp: $num;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

:deep(.el-checkbox) {
    margin-right: 18px;
}

.pop_select_box {
    height: 84px;

    .upload_btn {
        margin-top: 8px;
    }

    .upload_pop {
        background: #fff;
        border-radius: 12px;

        // box-shadow: 0px 2px 4px 0px rgba(216, 216, 216, 0.5);
        display: flex;
        align-items: center;
        justify-content: space-around;

        .item_pop {
            width: 60px;
            height: 62px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;

            .item_pop_icon {
                width: 40px;
                cursor: pointer;
            }

            .item_pop_name {
                font-size: 14px;
                margin-top: 2px;
                white-space: nowrap;
                font-family: PingFangSC-Regular, 'PingFang SC';
                font-weight: 400;
                color: #1a1918;
            }
        }
    }
}

.container {
    position: relative;
    width: 600px;
    height: 480px;
    background: #f8f8f8;
    border-radius: 4px;

    :deep(.el-textarea__inner) {
        border: none;
        box-shadow: none;
        background-color: #f8f8f8;
        border-bottom: 1px solid #eaeaea;
    }

    .text_btn {
        display: flex;
        justify-content: space-between;
        padding: 5px;
        color: #ff6b00;
    }

    .text_hover {
        position: absolute;
        bottom: 15px;
        align-items: center;
        left: 15px;
        z-index: 10;
        display: flex;
        cursor: pointer;
        width: 410px;
        padding: 0 12px;
        color: #969696;
        background: #f8f8f8;
        border: 1px solid #d9d9d9;
    }

    .upload_list_box {
        overflow: hidden;
        height: 230px;
    }

    .upload_list {
        .upload_item {
            margin-top: 5px;
            width: 440px;
            height: 32px;
            box-sizing: border-box;
            background: #eaeaea;
            display: flex;
            padding: 0 10px 0 14px;
            align-items: center;

            .file_icon {
                width: 20px;
                height: 20px;
                margin-right: 7px;
            }

            .file_name {
                width: 375px;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
            }

            .del_icon {
                width: 10px;
                height: 10px;
                cursor: pointer;
            }
        }
    }

    .prev_box {
        flex: 1;
        position: absolute;
        right: -480px;
        top: 0;

        .phone_con {
            // justify-content: center;
            position: relative;
            margin: -20px auto;
            width: 244px;
            height: 495px;
            box-sizing: border-box;
            border-radius: 36px;
            border: 9px solid #eef5fe;
            background: url('@/assets/image/channel/phone_bg.png');
            background-size: cover;

            .phone-title {
                position: absolute;
                top: -40px;
                left: 75px;
            }

            .phone_List {
                width: 100%;
                box-sizing: border-box;
                position: absolute;
                top: 48px;
                height: 380px;
                bottom: 48px;
                padding: 7px 10px;

                .bg_friend {
                    // width: 100%;

                    .public_title {
                        font-size: 11px;
                        margin-top: -10px;
                        text-align: center;
                        font-family: STHeitiSC-Light, STHeitiSC;
                        font-weight: 300;
                        color: #33302d;
                    }

                    .public_time {
                        text-align: center;
                        font-size: 11px;
                        font-family: STHeitiSC-Light, STHeitiSC;
                        font-weight: 300;
                        color: #969696;
                    }

                    .user_con {
                        margin-top: 10px;
                        display: flex;

                        .user_avator {
                            width: 22px;
                            height: 22px;
                            margin-right: 4px;
                        }

                        .friend_main {
                            flex: 1;

                            .user_name {
                                font-size: 12px;
                                margin-top: -8px;
                                font-family: STHeitiSC-Medium, STHeitiSC;
                                font-weight: 500;
                                color: #969696;
                                transform: scale(0.6);
                                transform-origin: left top;
                                margin-bottom: 4px;
                            }

                            .welcomeWords {
                                position: relative;
                                margin-top: -23px;
                                font-size: 12px;
                                color: #969696;
                                line-height: 15px;
                                transform: scale(0.6);
                                transform-origin: left top;
                                width: 160px;
                                box-sizing: border-box;
                                height: 67px;
                                overflow: hidden;
                                padding: 5px 10px;
                                background-color: #fff;
                                border-radius: 5px;

                                @include ellips(4);

                                &::after {
                                    content: '';
                                    position: absolute;
                                    left: -5px;
                                    top: 10px;
                                    width: 0;
                                    height: 0;
                                    border-top: 5px solid transparent;
                                    border-right: 8px solid #fff;
                                    border-bottom: 5px solid transparent;
                                }
                            }

                            .send_image {
                                width: 68px;
                                height: 46px;
                                margin-top: -23px;
                            }

                            .video_list {
                                position: relative;
                                width: 80px;
                                height: 55px;
                                margin-top: -23px;

                                .video_image {
                                    width: 100%;
                                    height: 100%;
                                }

                                .video_play {
                                    width: 15px;
                                    height: 15px;
                                    position: absolute;
                                    left: 50%;
                                    top: 50%;
                                    transform: translate(-50%, -50%);
                                }
                            }

                            .user_link {
                                // margin-left: 5px;
                                margin-top: -23px;
                                position: relative;
                                width: 151px;
                                height: 65px;
                                box-sizing: border-box;
                                padding: 5px 10px;
                                border-radius: 5px;
                                background: #fff;

                                &::after {
                                    content: '';
                                    position: absolute;
                                    left: -5px;
                                    top: 10px;
                                    width: 0;
                                    height: 0;
                                    border-top: 5px solid transparent;
                                    border-right: 8px solid #fff;
                                    border-bottom: 5px solid transparent;
                                }

                                .user_link_tit {
                                    width: 100%;
                                    font-size: 12px;
                                    font-family: STHeitiSC-Light, STHeitiSC;
                                    font-weight: 300;
                                    color: #000;
                                    transform: scale(0.83);
                                    transform-origin: left top;

                                    @include ellips(2);
                                }

                                .user_link_main {
                                    margin-top: 4px;
                                    display: flex;

                                    .user_link_desc {
                                        width: 110px;
                                        font-size: 12px;
                                        font-family: STHeitiSC-Light, STHeitiSC;
                                        font-weight: 300;
                                        color: #969696;
                                        transform: scale(0.6);
                                        transform-origin: left top;
                                        margin-top: 2px;

                                        @include ellips(3);
                                    }

                                    .user_link_icon {
                                        width: 22px;
                                        height: 22px;
                                    }
                                }

                                .m_t {
                                    margin-top: -15px;
                                }
                            }

                            .user_file {
                                position: relative;

                                // margin-left: 5px;
                                margin-top: -23px;
                                width: 150px;
                                height: 48px;
                                box-sizing: border-box;
                                padding: 8px;
                                border-radius: 3px;
                                background: #fff;

                                &::after {
                                    content: '';
                                    position: absolute;
                                    left: -5px;
                                    top: 6px;
                                    width: 0;
                                    height: 0;
                                    border-top: 5px solid transparent;
                                    border-right: 10px solid #fff;
                                    border-bottom: 5px solid transparent;
                                }

                                .user_file_main {
                                    display: flex;

                                    .user_file_desc {
                                        width: 105px;
                                        font-size: 12px;
                                        transform: scale(0.83);

                                        // overflow: hidden;
                                        // white-space: nowrap;
                                        // text-overflow: ellipsis;
                                        transform-origin: left top;
                                        margin-bottom: 2px;
                                        font-family: STHeitiSC-Light, STHeitiSC;
                                        font-weight: 300;
                                        color: #000;

                                        @include ellips(1);
                                    }

                                    .user_file_icon {
                                        width: 30px;
                                        height: 30px;
                                    }
                                }

                                .user_file_size {
                                    // margin-top: 2px;
                                    font-family: STHeitiSC-Light, STHeitiSC;
                                    font-weight: 300;
                                    color: #969696;
                                    font-size: 12px;
                                    transform: scale(0.6);
                                    transform-origin: left top;
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    .welc_time_top {
        display: flex;
        align-items: center;
        width: 600px;
        height: 40px;
        font-size: 14px;
        font-family: STHeitiSC-Medium, STHeitiSC;
        font-weight: 500;
        color: #33302db3;
        line-height: 20px;
        background: #fffaf9;

        .radius_left {
            width: 8px;
            height: 8px;
            margin: 0 20px;
            border-radius: 50%;
            background: #ff6b00;
        }
    }

    .welc_content_t {
        display: flex;
        align-items: center;
        margin: 20px 0;

        .welc_color {
            width: 3px;
            height: 18px;
            background: #ff6b00;
            margin-right: 10px;
        }
    }

    .welc_content_c {
        width: 600px;
        height: 103px;
        padding: 0 0 0 10px;
        background: #fff;
        border: 1px solid #eaeaea;

        .check_box {
            display: flex;
            margin-bottom: 6px;
        }
    }
}

.form-staffs {
    display: flex;

    .title {
        margin-right: 12px;
    }

    .staffs {
        &_item {
            height: 22px;
            line-height: 22px;
            margin-right: 6px;

            // padding: 0;
            color: #35383a;
            border: 1px solid #fffaf9;
            border-radius: 1px;
            background: #fffaf9;
        }

        :deep .el-tag .el-icon {
            width: 12px;
            height: 12px;
            color: #fff;
            background: #d9d9d9;
        }

        :deep .el-tag .el-icon svg {
            margin: 0;
        }

        :deep .el-tag .el-tag__close:hover {
            background: #d9d9d9;
        }

        :deep span.el-tag.el-tag--light.staffs_item::before {
            content: '';
            display: inline-block;
            width: 10px;
            height: 11px;
            background: url('@/assets/image/LiveCode/people_icon.png') center/100% no-repeat;
            margin-right: 10px;
        }
    }
}

.miniApp {
    width: 150px;
    height: 164px;
    background: #fff;
    padding: 10px 5px;
    box-sizing: border-box;

    .mini_box {
        display: flex;
        align-items: center;
        margin-bottom: 7px;

        .mini_icon {
            width: 13px;
            height: 13px;
            margin-right: 4px;
        }
    }

    .miniName {
        line-height: 12px;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mini_bg {
        text-align: center;
        height: 106px;
        padding-bottom: 5px;
        border-bottom: 1px solid #eaeaea;
    }

    .mini_bot {
        line-height: 18px;

        img {
            width: 8px;
            height: 7px;
        }

        span {
            display: inline-block;
            font-size: 12px;
            transform: scale(0.68);
        }
    }

    .miniImg {
        width: 100%;
        height: 106px;
        margin: 0 auto;
    }
}

.alias {
    margin-left: 15px;
}

:deep(.contentBox) {
    display: grid;
    grid-column-gap: 10px;
    grid-template-columns: repeat(5, 40px);
    align-items: center;
}
</style>
